Skip to content

test: add 56 unit tests for semantic, slab_alloc, and ast_profile modules#681

Open
RollerCoaster1899 wants to merge 3 commits into
DeusData:mainfrom
RollerCoaster1899:test/add-unit-tests-semantic-slab-astprofile
Open

test: add 56 unit tests for semantic, slab_alloc, and ast_profile modules#681
RollerCoaster1899 wants to merge 3 commits into
DeusData:mainfrom
RollerCoaster1899:test/add-unit-tests-semantic-slab-astprofile

Conversation

@RollerCoaster1899

Copy link
Copy Markdown

Summary

Adds 56 unit tests across 3 new test files for previously untested modules:

  • tests/test_semantic.c (32 tests): cbm_sem_tokenize (camel/snake/dot/abbrev), cbm_sem_cosine (identical/orthogonal/zero/negative/null), cbm_sem_normalize, cbm_sem_vec_add_scaled, cbm_sem_random_index (determinism), cbm_sem_proximity, cbm_sem_diffuse, corpus lifecycle, IDF, config
  • tests/test_slab_alloc.c (14 tests): Slab malloc/free (≤64B and >64B), calloc zeroing/overflow, realloc (shrink/promote/same-size), free-list cycling, pointer uniqueness, thread reset
  • tests/test_ast_profile.c (10 tests): to_str/from_str round-trip (25 fields), null/empty/invalid inputs, to_vector range/saturation

Verification

./build/c/test-runner semantic ast_profile slab_alloc

All 56 pass with ASan+UBSan.

Files modified

  • Makefile.cbm: Register new test sources in ALL_TEST_SRCS
  • tests/test_main.c: Register suite_semantic, suite_ast_profile, suite_slab_alloc

…ules

Add focused unit tests for three previously untested modules:

- tests/test_semantic.c (32 tests): cbm_sem_tokenize (camel/snake/dot/abbrev),
  cbm_sem_cosine (identical/orthogonal/zero/negative/null),
  cbm_sem_normalize, cbm_sem_vec_add_scaled,
  cbm_sem_random_index (determinism), cbm_sem_proximity,
  cbm_sem_diffuse, corpus lifecycle, IDF, config

- tests/test_slab_alloc.c (14 tests): slab malloc/free (≤64B and >64B),
  calloc zeroing/overflow, realloc (shrink/promote/same-size),
  free-list cycling, pointer uniqueness, thread reset

- tests/test_ast_profile.c (10 tests): to_str/from_str round-trip
  (25 fields), null/empty/invalid inputs, to_vector range/saturation

All 56 tests pass with ASan+UBSan. Registered in Makefile.cbm
and test_main.c.

Signed-off-by: Raul Acosta <raulacosta@users.noreply.github.com>
Signed-off-by: Raul Acosta <raul.acosta.mmm@gmail.com>
@RollerCoaster1899 RollerCoaster1899 force-pushed the test/add-unit-tests-semantic-slab-astprofile branch from 9c50b26 to 08437cf Compare June 29, 2026 15:45
@DeusData

Copy link
Copy Markdown
Owner

Huge thanks for opening this PR and for the work you put into it.

The maintainer shop is currently full, so this may sit for a bit before it gets a proper review. We will come back to this as soon as possible with real feedback; I wanted to make sure it did not sit unacknowledged in the meantime.

@DeusData DeusData added priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens. enhancement New feature or request labels Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority/backlog Valuable contribution, lower scheduling urgency; review when maintainer capacity opens.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants